package cn.shopping.core.daomanager.immutable;

import cn.shopping.common.daomanager.CommonDaoManager;
import cn.shopping.core.dbo.GoodsDO;
import org.springframework.util.CollectionUtils;

import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;


/**
 * 代码自动生成，请不要修改，切记！！！
 */
public interface ImmutableGoodsDaoManager extends CommonDaoManager<GoodsDO,Long> {


        public List<GoodsDO> listByTitle(String title, String... fieldNames);

        public Map<Long,GoodsDO> mapByTitle(String title, String... fieldNames);

        public Integer countByTitle(String title);

        public default GoodsDO singleResultByTitle(String title,String... fieldNames){
             List<GoodsDO> list=this.listByTitle(title,fieldNames);
             return CollectionUtils.isEmpty(list)?null:list.get(0);
        }

         public default <T> Map<T,List<GoodsDO>> groupingByTitle(String title, Function<GoodsDO, T> mapper, String... fieldNames){
             List<GoodsDO> list=this.listByTitle(title,fieldNames);
             if(CollectionUtils.isEmpty(list)){
                return new HashMap<>();
             }
             return list.stream().collect(Collectors.groupingBy(mapper));
         }

        public Integer updateNotNullFieldsByTitle(GoodsDO updateDO, String title);

        public Integer updateAllFieldsByTitle(GoodsDO updateDO,  String title);

        public Integer deleteByTitle( String title);






        public List<GoodsDO> listByInTitle(Collection<String> titleList, String... fieldNames);

         public Map<Long,GoodsDO> mapByInTitle(Collection<String> titleList, String... fieldNames);

         public Integer countByInTitle(Collection<String> titleList);

         public default GoodsDO singleResultByInTitle(Collection<String> titleList,String... fieldNames){
              List<GoodsDO> list=this.listByInTitle(titleList,fieldNames);
              return CollectionUtils.isEmpty(list)?null:list.get(0);
         }

          public default <T> Map<T,List<GoodsDO>> groupingByInTitle(Collection<String> titleList, Function<GoodsDO, T> mapper, String... fieldNames){
              List<GoodsDO> list=this.listByInTitle(titleList,fieldNames);
              if(CollectionUtils.isEmpty(list)){
                 return new HashMap<>();
              }
              return list.stream().collect(Collectors.groupingBy(mapper));
          }

         public Integer updateNotNullFieldsByInTitle(GoodsDO updateDO, Collection<String> titleList);

         public Integer updateAllFieldsByInTitle(GoodsDO updateDO,  Collection<String> titleList);

         public Integer deleteByInTitle( Collection<String> titleList);
        public List<GoodsDO> listByDescribe(String describe, String... fieldNames);

        public Map<Long,GoodsDO> mapByDescribe(String describe, String... fieldNames);

        public Integer countByDescribe(String describe);

        public default GoodsDO singleResultByDescribe(String describe,String... fieldNames){
             List<GoodsDO> list=this.listByDescribe(describe,fieldNames);
             return CollectionUtils.isEmpty(list)?null:list.get(0);
        }

         public default <T> Map<T,List<GoodsDO>> groupingByDescribe(String describe, Function<GoodsDO, T> mapper, String... fieldNames){
             List<GoodsDO> list=this.listByDescribe(describe,fieldNames);
             if(CollectionUtils.isEmpty(list)){
                return new HashMap<>();
             }
             return list.stream().collect(Collectors.groupingBy(mapper));
         }

        public Integer updateNotNullFieldsByDescribe(GoodsDO updateDO, String describe);

        public Integer updateAllFieldsByDescribe(GoodsDO updateDO,  String describe);

        public Integer deleteByDescribe( String describe);






        public List<GoodsDO> listByInDescribe(Collection<String> describeList, String... fieldNames);

         public Map<Long,GoodsDO> mapByInDescribe(Collection<String> describeList, String... fieldNames);

         public Integer countByInDescribe(Collection<String> describeList);

         public default GoodsDO singleResultByInDescribe(Collection<String> describeList,String... fieldNames){
              List<GoodsDO> list=this.listByInDescribe(describeList,fieldNames);
              return CollectionUtils.isEmpty(list)?null:list.get(0);
         }

          public default <T> Map<T,List<GoodsDO>> groupingByInDescribe(Collection<String> describeList, Function<GoodsDO, T> mapper, String... fieldNames){
              List<GoodsDO> list=this.listByInDescribe(describeList,fieldNames);
              if(CollectionUtils.isEmpty(list)){
                 return new HashMap<>();
              }
              return list.stream().collect(Collectors.groupingBy(mapper));
          }

         public Integer updateNotNullFieldsByInDescribe(GoodsDO updateDO, Collection<String> describeList);

         public Integer updateAllFieldsByInDescribe(GoodsDO updateDO,  Collection<String> describeList);

         public Integer deleteByInDescribe( Collection<String> describeList);
        public List<GoodsDO> listByPrice(Double price, String... fieldNames);

        public Map<Long,GoodsDO> mapByPrice(Double price, String... fieldNames);

        public Integer countByPrice(Double price);

        public default GoodsDO singleResultByPrice(Double price,String... fieldNames){
             List<GoodsDO> list=this.listByPrice(price,fieldNames);
             return CollectionUtils.isEmpty(list)?null:list.get(0);
        }

         public default <T> Map<T,List<GoodsDO>> groupingByPrice(Double price, Function<GoodsDO, T> mapper, String... fieldNames){
             List<GoodsDO> list=this.listByPrice(price,fieldNames);
             if(CollectionUtils.isEmpty(list)){
                return new HashMap<>();
             }
             return list.stream().collect(Collectors.groupingBy(mapper));
         }

        public Integer updateNotNullFieldsByPrice(GoodsDO updateDO, Double price);

        public Integer updateAllFieldsByPrice(GoodsDO updateDO,  Double price);

        public Integer deleteByPrice( Double price);






        public List<GoodsDO> listByInPrice(Collection<Double> priceList, String... fieldNames);

         public Map<Long,GoodsDO> mapByInPrice(Collection<Double> priceList, String... fieldNames);

         public Integer countByInPrice(Collection<Double> priceList);

         public default GoodsDO singleResultByInPrice(Collection<Double> priceList,String... fieldNames){
              List<GoodsDO> list=this.listByInPrice(priceList,fieldNames);
              return CollectionUtils.isEmpty(list)?null:list.get(0);
         }

          public default <T> Map<T,List<GoodsDO>> groupingByInPrice(Collection<Double> priceList, Function<GoodsDO, T> mapper, String... fieldNames){
              List<GoodsDO> list=this.listByInPrice(priceList,fieldNames);
              if(CollectionUtils.isEmpty(list)){
                 return new HashMap<>();
              }
              return list.stream().collect(Collectors.groupingBy(mapper));
          }

         public Integer updateNotNullFieldsByInPrice(GoodsDO updateDO, Collection<Double> priceList);

         public Integer updateAllFieldsByInPrice(GoodsDO updateDO,  Collection<Double> priceList);

         public Integer deleteByInPrice( Collection<Double> priceList);


}

